<?php

/**
 * author : Tran Minh Toan
 */

class Zend_View_Helper_showTableUser{
    
    public function showTableUser($view){
        
        $arrUser = $view->arrUser;
        
        $strHtml = '';
        $strHtml .= '<table class="hovertable">';
        $strHtml .= '<tr>';
        $strHtml .= '<th>ID</th>';
        $strHtml .= '<th>Họ và tên</th>';
        $strHtml .= '<th>Tên tài khoản</th>';
        $strHtml .= '<th>Mật khẩu</th>';
        $strHtml .= '<th>Địa chỉ</th>';
        $strHtml .= '<th>Ngày sinh</th>';
        $strHtml .= '<th>ID Card</th>';
        $strHtml .= '<th>Phân quyền</th>';
        $strHtml .= '<th>Thao tác</th>';
        $strHtml .= '</tr>';
        
        if(isset ($arrUser)){
            foreach ($arrUser as $user) {
                $strHtml .= '<tr id="tablerow">';
                $strHtml .= '<td>'.$user->user_id.'</td>';
                $strHtml .= '<td>'.$user->user_fullname.'</td>';
                $strHtml .= '<td>'.$user->user_account.'</td>';
                $strHtml .= '<td>'.$user->user_password.'</td>';
                $strHtml .= '<td>'.$user->user_address.'</td>';
                $strHtml .= '<td>'.$user->user_birthday.'</td>';
                $strHtml .= '<td>'.$user->user_idcard.'</td>';
                switch ($user->user_role){
                    case 0:
                        $temp="Administrator";
                        break;
                    case 1:
                        $temp="Employee";
                        break;
                    case 2:
                        $temp="Client";
                        break;     
                }
                $strHtml .= '<td>'.$temp.'</td>';
                $strHtml .= '<td><a class="icon-1" href="'.$view->baseUrl().'/admin/user/edit/id/'.$user->user_id.'"/>
                             <a class="icon-2" href="'.$view->baseUrl().'/admin/user/delete/id/'.$user->user_id.'"/></td>';
                $strHtml .= '</tr>';
            }
        }
        
        $strHtml .= '</table>';
        return $strHtml;
    }
}
?>

